/** 
 * 项目名:shiro 
 * 文件名:MyRealm2.java 
 * 包名:com.spring.shiro.realm 
 * 创建日期:2015年2月13日下午2:40:45 
 * 版权(c): ZTESOFT TECHNOLOGY CO.,LTD.Copyright 2012-2030.All rights reserved
 * 
*/  
  
package com.spring.shiro.realm;  

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.realm.Realm;
 
public class MyUserRealm2 implements Realm {

	@Override
	public String getName() {

		return "b";
	}

	@Override
	public boolean supports(AuthenticationToken token) {

		return token instanceof UsernamePasswordToken;
	}

	@Override
	public AuthenticationInfo getAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {

		return new SimpleAuthenticationInfo(
			"zhang",
			"123",
			getName()
		);
	}

}
  